package com.huiyeji.dynamic.core;

import com.huiyeji.sort.SortedComparator;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/**
 * @author Huiyeji
 */
public abstract class DynamicResult {

    public DynamicResult(int status, boolean success, DynamicContext context) {
        this.status = status;
        this.success = success;
        this.monitorData.putAll(context.getMonitor().getMonitorData());
        this.returnData.putAll(context.getReturnData());
    }

    private final int status;

    private final boolean success;

    private final Map<String,Object> monitorData = new TreeMap<>(new SortedComparator<>());

    private final Map<String,Object> returnData = new HashMap<>();

    public int getStatus() {
        return status;
    }

    public boolean isSuccess() {
        return success;
    }

    public Map<String, Object> getMonitorData() {
        return monitorData;
    }

    public Map<String, Object> getReturnData() {
        return returnData;
    }
}
